package com.learn.java;

import org.apache.struts2.dispatcher.StrutsResultSupport;

import com.opensymphony.xwork2.ActionInvocation;
// 自定义结果类的视图
public class ImageResult  extends StrutsResultSupport{
	private static final long serialVersionUID = -4574584297374814403L;
	
	@Override
	protected void doExecute(String finalLocation, ActionInvocation invocation)
			throws Exception {
		System.out.println("doExecute");
//		ValidateCode vc = new ValidateCode(120, 80, 4, 100);
//		BufferedImage image = vc.getBuffImg();
//		//输出即可
//		HttpServletResponse response = ServletActionContext.getResponse();
//		ImageIO.write(image, "jpeg", response.getOutputStream());
	}

	
//	public String execute() throws IOException{
//		System.out.println("execute");
//		ValidateCode vc = new ValidateCode(120, 80, 4, 100);
//		BufferedImage image = vc.getBuffImg();
//		//输出即可
//		HttpServletResponse response = ServletActionContext.getResponse();
//		ImageIO.write(image, "jpeg", response.getOutputStream());
//		return "success";
//	}
	
	
	
	
}
